﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FITClub.LevelBuilder.Helper
{
    internal struct VisibilityChangeTarget
    {
        public Control Target {get; private set;}
        public int? Width { get; set; }
        public int? Height { get; set; }

        public VisibilityChangeTarget(Control target) : this()
        {           
            Target = target;
            Width = null;
            Height = null;
        }

        public void ChangeVisibility()
        {
            this.Target.Visible = !this.Target.Visible;
            if (this.Target.Visible)
            {
                if (this.Width != null)
                {
                    this.Target.Width = this.Width.Value;
                }
                if (this.Height != null)
                {
                    this.Target.Height = this.Height.Value;
                }
                this.Target.Focus();
            }
        }
    }
}
